﻿using DryIoc;
using Prism.Regions;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace AIVision.UI.Views
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainView : Window
    {
        private readonly IRegionManager regionManager;

        public MainView(IRegionManager regionManager)
        {
            InitializeComponent();
            this.regionManager = regionManager;
        }

        private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
        {
           
        }



        private void TabItem_Closed(object sender, EventArgs e)
        {

        }

        private void tabControl_Closing(object sender, EventArgs e)
        {
            var v = e as HandyControl.Data.CancelRoutedEventArgs;
            v.Cancel = true;
            var v2 = v.OriginalSource as UserControl;
            var region = regionManager.Regions["MainRegion"];
            foreach(var v3 in region.Views)
            {
                if (v.OriginalSource == v3)
                    region.Remove(v3);
            }
        }

        private void Grid_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
        {

        }
    }
}
